﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CYM
{
    public partial class CYM : Form
    {
        
        public CYM()
        {
            InitializeComponent();
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                AMC1.Stop();

                AMC1.PTZControlURL = "http://" + textBox1.Text + "/axis-cgi/com/ptz.cgi";
                AMC1.UIMode = "ptz-absolute";

                // Show the status bar and the tool bar in the AXIS Media Control
                AMC1.ShowStatusBar = true;
                AMC1.ShowToolbar = true;
                AMC1.StretchToFit = true;
                AMC1.EnableContextMenu = true;
                AMC1.ToolbarConfiguration = "default,+ptz";

                // Set the media URL and the media type
                AMC1.MediaURL = "http://" + textBox1.Text + "/axis-cgi/mjpg/video.cgi";
                AMC1.MediaType = "mjpeg";

                // Start the download of the mjpeg stream from the Axis camera/video server
                AMC1.Play();
            }
            catch (ArgumentException ArgEx)
            {
                MessageBox.Show(ArgEx.Message, "Error");
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message, "Error");
            }

        }
    }
}